NLTK Using Parts of word suggestion

by: russell, 7 years ago

Last edited: 7 years ago

I would like to be able to identify parts of word such as verb, noun, adverb, etc. and display it. I have the following snippet:

import nltk

text1 = nltk.word_tokenize("It is a nice day today")
tagged = nltk.pos_tag(text1)

print(tagged)
and the result is:
[('It', 'PRP'), ('is', 'VBZ'), ('a', 'DT'), ('nice', 'JJ'), ('day', 'NN'), ('today', 'NN')]
I like to display for example 'nice' is adjective as opposed to JJ. Is there a object/method/module that handles it or I have to create my lookup list and handle it?



You must be logged in to post. Please login or register an account.



AFAIK you would need to convert them yourself with something like a lookup table or just a dictionary.

-Harrison 7 years ago

You must be logged in to post. Please login or register an account.